<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:c="http://java.sun.com/jstl/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg" id="globalMessages"/>
    
    <h:form id="facilitySearch" styleClass="edit">
    
        <rich:simpleTogglePanel label="Facility search parameters" switchType="ajax">
        
					<s:decorate template="layout/display.xhtml">
						<ui:define name="label">Max price range</ui:define>
						<rich:inputNumberSlider
							value="#{facilityList.facility.priceRange}"
							enableManualInput="false"
							maxValue="5"
							inputStyle="width: 1.5em; text-align: center;"
							width="138px">
							<a4j:support event="onchange" ajaxSingle="true"/>
						</rich:inputNumberSlider>
						<div style="margin-top: 5px;"><strong>0</strong> = disabled, <strong>1</strong> = $30 or less, <strong>2</strong> = $31-60, <strong>3</strong> = $61-90, <strong>4</strong> = $91-120, <strong>5</strong> = $120 or more</div>
					</s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">address</ui:define>
                <h:inputText id="address" value="#{facilityList.facility.address}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">city</ui:define>
                <h:inputText id="city" value="#{facilityList.facility.city}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">country</ui:define>
                <h:inputText id="country" value="#{facilityList.facility.country}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">county</ui:define>
                <h:inputText id="county" value="#{facilityList.facility.county}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">description</ui:define>
                <h:inputText id="description" value="#{facilityList.facility.description}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">name</ui:define>
                <h:inputText id="name" value="#{facilityList.facility.name}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">phone</ui:define>
                <h:inputText id="phone" value="#{facilityList.facility.phone}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">state</ui:define>
                <h:inputText id="state" value="#{facilityList.facility.state}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">type</ui:define>
                <h:inputText id="type" value="#{facilityList.facility.type}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">uri</ui:define>
                <h:inputText id="uri" value="#{facilityList.facility.uri}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">zip</ui:define>
                <h:inputText id="zip" value="#{facilityList.facility.zip}"/>
            </s:decorate>

        
        </rich:simpleTogglePanel>
        
        <div class="actionButtons">
            <h:commandButton id="search" accesskey="s" value="Search" action="/FacilityList.xhtml"/>
            <s:button id="reset" accesskey="r" value="Reset" action="reset"/>
        </div>
        
    </h:form>
    
		<a4j:outputPanel id="facilityListBranch" layout="none" ajaxRendered="true">
    <rich:panel id="facilityListPanel">
        <f:facet name="header">Facility search results (#{facilityList.resultList.size})</f:facet>
    <div class="results" id="facilityList">

    <h:outputText value="No facility exists" 
               rendered="#{empty facilityList.resultList}"/>
               
	<h:form>
    <rich:dataTable id="facilityList" 
                var="facility"
              value="#{facilityList.resultList}" 
           rendered="#{not empty facilityList.resultList}">
        <c:set var="entitylist" value="#{facilityList}"/>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="id"/>
                </ui:decorate>
            </f:facet>
            #{facility.id}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="address"/>
                </ui:decorate>
            </f:facet>
            #{facility.address}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="city"/>
                </ui:decorate>
            </f:facet>
            #{facility.city}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="country"/>
                </ui:decorate>
            </f:facet>
            #{facility.country}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="county"/>
                </ui:decorate>
            </f:facet>
            #{facility.county}
        </h:column>
        <h:column rendered="false">
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="description"/>
                </ui:decorate>
            </f:facet>
            #{facility.description}
        </h:column>
        <h:column rendered="false">
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="drivingRange"/>
                </ui:decorate>
            </f:facet>
            #{facility.drivingRange}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="name"/>
                </ui:decorate>
            </f:facet>
            #{facility.name}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="phone"/>
                </ui:decorate>
            </f:facet>
            #{facility.phone}
        </h:column>
        <h:column rendered="false">
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="proShop"/>
                </ui:decorate>
            </f:facet>
            #{facility.proShop}
        </h:column>
        <h:column rendered="false">
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="rentsClubs"/>
                </ui:decorate>
            </f:facet>
            #{facility.rentsClubs}
        </h:column>
        <h:column rendered="false">
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="restaurant"/>
                </ui:decorate>
            </f:facet>
            #{facility.restaurant}
        </h:column>
        <h:column rendered="false">
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="snackBar"/>
                </ui:decorate>
            </f:facet>
            #{facility.snackBar}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="state"/>
                </ui:decorate>
            </f:facet>
            #{facility.state}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="type"/>
                </ui:decorate>
            </f:facet>
            #{facility.type}
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="uri"/>
                </ui:decorate>
            </f:facet>
						<h:outputLink value="#{facility.uri}">#{facility.uri}</h:outputLink>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="priceRange"/>
                </ui:decorate>
            </f:facet>
						<h:outputText value="$" rendered="#{facility.priceRange eq 1}"/>
						<h:outputText value="$$" rendered="#{facility.priceRange eq 2}"/>
						<h:outputText value="$$$" rendered="#{facility.priceRange eq 3}"/>
						<h:outputText value="$$$$" rendered="#{facility.priceRange eq 4}"/>
						<h:outputText value="$$$$$" rendered="#{facility.priceRange eq 5}"/>
						<ui:remove>#{facility.priceRange}</ui:remove>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:decorate template="layout/sort.xhtml">
				    <ui:param name="property" value="zip"/>
                </ui:decorate>
            </f:facet>
            #{facility.zip}
        </h:column>
        <h:column>
            <f:facet name="header">action</f:facet>
            <s:link view="/#{empty from ? 'Facility' : from}.xhtml" 
                   value="Select" 
                      id="facility" rendered="#{not pageflow.inProcess}">
                <f:param name="facilityId" 
                        value="#{facility.id}"/>
            </s:link>
            <s:link action="select" value="Select" rendered="#{pageflow.inProcess}">
              <f:param name="facilityId" value="#{facility.id}"/>
            </s:link>
        </h:column>
    </rich:dataTable>
</h:form>
    </div>
    </rich:panel>
    
    <s:div id="facilityListNav" styleClass="tableControl">
      
        <s:link view="/FacilityList.xhtml" 
            rendered="#{facilityList.previousExists}" 
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>
        
        <s:link view="/FacilityList.xhtml" 
            rendered="#{facilityList.previousExists}" 
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult" 
                    value="#{facilityList.previousFirstResult}"/>
        </s:link>
        
        <s:link view="/FacilityList.xhtml" 
            rendered="#{facilityList.nextExists}" 
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult" 
                    value="#{facilityList.nextFirstResult}"/>
        </s:link>
        
        <s:link view="/FacilityList.xhtml" 
            rendered="#{facilityList.nextExists}" 
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult" 
                    value="#{facilityList.lastFirstResult}"/>
        </s:link>
        
    </s:div>
		</a4j:outputPanel>
    
    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/FacilityEdit.xhtml"
                    id="create" 
                 value="Create facility">
            <f:param name="facilityId"/>
        </s:button>
    </s:div>
    
</ui:define>

</ui:composition>

